Overview

You've recapped the principles of UX and UI and produced your app's wireframe. In this exercise, you’ll go one step further by discovering how to use auto layout in Figma to create an interactive component such as a button. Auto layout can be added to frames to create dynamic components that respond to the size of their child objects. For instance, a button that grows with the length of its label.

Scenario

You can reuse the interactive component button that you will create by using auto layout in this exercise in your solution for the Little Lemon food delivery app.

Instructions

Step 1: Create a basic button using auto layout

Note: You have now created a functioning auto layout frame that is the foundation for a button. When you change the label, the button will dynamically resize to fit accordingly, as in the examples below:

Note: The maximum value for a corner radius is 50% of the element's height.

Step 2: Create a component

Select the frame and text and create a component. Alternatively, use the keyboard shortcut, Ctrl + Alt + K on Windows or Cmd + Alt + K on Mac.

Step 3: Add variants

Variants allow you to group different visual versions of your components into one container. They are component combinations that you can group as a single component set. Variants are added to improve design reality through natural gestures. You can add variants to a component after you have created it.

Consider two scenarios when designing a mobile device button: untouched and clicked.

Step 4: Create an interactive component

Step 5: Use the component

After creating a component, you can use it instantly, so:

Step 6: View the interactive component

Go to Present mode in the top right corner and test your button.

Conclusion

In this exercise, you learned how to use auto layout to create an interactive component. Here, the auto layout option allowed your button to resize automatically as more properties are added to it.